import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString, Matches } from 'class-validator';

export class CreateUserDto {
  @ApiProperty({
    description: '手机号',
    example: '13800000001',
  })
  @Matches(/^1[3456789]\d{9}$/, { message: '手机号格式不正确' })
  @IsNotEmpty({ message: '手机号不能为空' })
  readonly mobile: string;

  @ApiProperty({
    description: '昵称',
    example: '张三',
  })
  @IsNotEmpty({ message: '昵称不能为空' })
  @IsString({ message: '昵称必须是字符串' })
  readonly nickname: string;

  @ApiProperty({
    description: '密码',
    example: '123456',
  })
  @IsNotEmpty({ message: '密码不能为空' })
  readonly password: string;

  @ApiProperty({
    description: '重复密码',
    example: '123456',
  })
  @IsNotEmpty({ message: '重复密码不能为空' })
  readonly passwordRepeat: string;
}
